import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import routes from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import BaiduMap from 'vue-baidu-map'
Vue.use(ElementUI)
Vue.use(BaiduMap, {
  ak: 'AEmfQ7gN6mSevGw5pOMtPEQA1iAOB8fk'
})
import './public-path'

Vue.use(VueRouter)

Vue.config.productionTip = false

let instance = null;
let router = null;
//single-spa的生命周期函数
export async function bootstrap() {
  console.log('$c[bootstrap] start', 'color:red;')
}

export async function mount() {
  router = new VueRouter({
    base: window.__POWERED_BY_QIANKUN__?'/app1':'/',
    mode: 'history',
    routes
  })
  instance = new Vue({
    router,
    render: h => h(App)
  }).$mount("#app2");
}

export async function unmount() {
  instance.$destroy();
  instance = null;
  router = null;
}

console.log(window.__POWERED_BY_QIANKUN__)
// 单独开发环境
window.__POWERED_BY_QIANKUN__ || mount();